package com.usian.feign;

import com.usian.pojo.*;
import com.usian.utils.CatResult;
import com.usian.utils.PageResult;
import com.usian.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "usian-item-service")
public interface ItemServiceFeign {

    @RequestMapping("/service/item/selectItemInfo")
    public TbItem selectItemInfo(@RequestParam("id")Long id);

    @GetMapping("/service/item/selectTbItemAllByPage")
    public PageResult selectTbItemAllByPage(@RequestParam Integer page, @RequestParam Integer rows);

    @RequestMapping("/service/itemCategory/selectItemCategoryByParentId")
    public List<TbItemCat> selectItemCategoryByParentId(@RequestParam Long id);

    @RequestMapping("/service/itemParam/selectItemParamByItemCatId")
    public TbItemParam selectItemParamByItemCatId(@RequestParam("itemCatId") Long itemCatId);

    @PostMapping("service/item/insertTbItem")
    public Integer insertTbItem(@RequestBody TbItem tbItem,@RequestParam String desc,@RequestParam String itemParams);

    @RequestMapping("service/item/preUpdateItem")
    public Map<String,Object> preUpdateItem(@RequestParam("itemId") Long itemId);

    @PostMapping("service/item/updateTbItem")
    public Integer updateTbItem(@RequestBody TbItem tbItem,@RequestParam String desc,@RequestParam String itemParams);

    @RequestMapping("service/item/deleteItemById")
    public Integer deleteItemById(@RequestParam Long itemId);

    @RequestMapping("/service/itemParam/selectItemParamAll")
    public PageResult selectItemParamAll(@RequestParam Integer page, @RequestParam Integer rows);

    /**
     * @param itemCatId
     * @param paramData
     * @return
     */
    @RequestMapping("/service/itemParam/insertItemParam")
    public Integer insertItemParam(@RequestParam Integer itemCatId,@RequestParam String paramData);

    /**
     * @param id
     * @return
     */
    @RequestMapping("/service/itemParam/deleteItemParamById")
    public Integer deleteItemParamById(@RequestParam Integer id);

    /**
     * @return
     */
    @RequestMapping("/service/itemCategory/selectItemCategoryAll")
    public CatResult selectItemCategoryAll();

    /**
     * 查询商品描述
     * @param itemId
     * @return
     */
    @RequestMapping("/service/item/selectItemDescByItemId")
    public TbItemDesc selectItemDescByItemId(@RequestParam Long itemId);

    /**
     * 查询商品参数
     * @param itemId
     * @return
     */
    @RequestMapping("/service/item/selectTbItemParamItemByItemId")
    public TbItemParamItem selectTbItemParamItemByItemId(@RequestParam Long itemId);
}
